import { defineStore } from 'pinia'
import { reactive, toRefs } from 'vue'
// 定义状态类型
interface heightType {
    windowHeight: number
  }
export const useScreenStore = defineStore('screen', () =>{
    const state = reactive<heightType>({
      windowHeight: window.innerHeight,
    })
    // 定义操作方法
    const actions = {
      updateWindowHeight() {
        state.windowHeight = window.innerHeight;
        return state.windowHeight; // 返回更新后的窗口高度
      },
    }
    return {
        ...toRefs(state),
        ...actions
    }
});